<ul id="agencyTree" class="ztree"></ul>
<script type="text/javascript">
var setting = {
		async: {
			enable: true,
			url:"../agent/o_agency_tree.jspx",
			autoParam:["root"],
			dataFilter: filter
		},
		callback: {
			onClick: onClick
		}
};

$().ready(function(){
	var agencyTree = $.fn.zTree.init($("#agencyTree"), setting);
})
function onClick( event, treeId, treeNode, clickFlag ){
	if( treeNode.root ){
		$('#recommentAgent').val( treeNode.recommentAgent );
		$('#recommentAccount').val( treeNode.recommentAccount );
	}
}
function filter(treeId, parentNode, childNodes) {
	if (!childNodes) return null;
	for (var i=0, l=childNodes.length; i<l; i++) {
		childNodes[i].name = childNodes[i].name.replace(/\.n/g, '.');
	}
	return childNodes;
}

</script>